//
//  MyOrderMenus.m
//  X-Touch2
//
//  Created by shengchao yang on 12-3-12.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "MyOrderMenus.h"
#import "DataBaseAccess.h"
#import "Common.h"

@implementation MyOrderMenus
@synthesize momLocalMenu;
@synthesize pbCode;
@synthesize ptTableNo;
@synthesize ptDescripts;
@synthesize persons;
@synthesize peEmpno;
@synthesize momDescript;
@synthesize momTime;
@synthesize momType;
@synthesize momSendErr;

//=========================================================== 
// - (id)init
//
//=========================================================== 
- (id)init
{
    self = [super init];
    if (self) {
 
    }
    return self;
}
//设置正在发送
- (void) updateSendErr{
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderMenus set momSendErr='1',momTime='%@' where momLocalMenu='%@'", CurrentTime, self.momLocalMenu];
    self.momSendErr = @"1";
    [DataBaseAccess Update:updateSql];
}
- (void) updatePersonNum:(NSString *)personNum{
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderMenus set persons='%@',momTime='%@' where momLocalMenu='%@'",personNum, CurrentTime, self.momLocalMenu];
    self.persons = personNum;
    [DataBaseAccess Update:updateSql];
}

- (void) insertNewMyOrderMenu{
    NSString *updateSql = [NSString stringWithFormat:@"insert into MyOrderMenus(momLocalMenu,pbCode,ptTableNo,ptDescripts,persons,peEmpno,momDescript,momTime,momType,momSendErr) values('"];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.momLocalMenu];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.pbCode];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.ptTableNo];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.ptDescripts];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.persons];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.peEmpno];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.momDescript];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.momTime];
    updateSql = [updateSql stringByAppendingFormat:@"%@','",self.momType];
    updateSql = [updateSql stringByAppendingFormat:@"%@')",self.momSendErr];
    [DataBaseAccess Update:updateSql];
}


//=========================================================== 
// dealloc
//=========================================================== 
- (void)dealloc {    
//    MyNSLog(@"MyOrderMenus dealloc momLocalMenu=%@",self.momLocalMenu);
    [momLocalMenu release];
    momLocalMenu = nil;
    [pbCode release];
    pbCode = nil;
    [ptTableNo release];
    ptTableNo = nil;
    [ptDescripts release];
    ptDescripts = nil;
    [persons release];
    persons = nil;
    [peEmpno release];
    peEmpno = nil;
    [momDescript release];
    momDescript = nil;
    [momTime release];
    momTime = nil;
    [momType release];
    momType = nil;
    [momSendErr release];
    momSendErr = nil;
    
    [super dealloc];
}


@end
